from flask import Flask, render_template, request
from vsearch import search4letters

app = Flask(__name__)

@app.route('/')#这个才是我们要的主页
@app.route('/index')
def index_page():
    return render_template('index.html')

@app.route('/search4', methods=['POST'])
def do_search() -> str:
    phrase = request.form['phrase']
    letters = request.form['letters']
    title = 'Here are your results: '
    results = str(search4letters(phrase, letters))
    return render_template('results.html', the_title=title, the_phrase=phrase, the_letters=letters, the_results=results)

# @app.route('/') 这是你原来的，因为两个@app.route('/'),导致程序没有一个确定的首页，把他删掉就好。
@app.route('/entry')
def entry_page() -> 'html':
    return render_template('entry.html', the_title='欢迎使用元音查询!')

if __name__ == '__main__':
    app.run(debug=True)
